//
//	MyAttendTopicModel.m
//
//	Create by jiaming yan on 1/11/2017
//	Copyright © 2017. All rights reserved.
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "MyAttendTopicModel.h"

NSString *const kMyAttendTopicModelCollectCount = @"collectCount";
NSString *const kMyAttendTopicModelContent = @"content";
NSString *const kMyAttendTopicModelCreateTime = @"createTime";
NSString *const kMyAttendTopicModelHeadImg = @"headImg";
NSString *const kMyAttendTopicModelImgList = @"imgList";
NSString *const kMyAttendTopicModelInteractionId = @"interactionId";
NSString *const kMyAttendTopicModelIsCollected = @"isCollected";
NSString *const kMyAttendTopicModelIsVeteran = @"isVeteran";
NSString *const kMyAttendTopicModelNickName = @"nickName";
NSString *const kMyAttendTopicModelTopicId = @"topicId";
NSString *const kMyAttendTopicModelTopicPic = @"topicPic";
NSString *const kMyAttendTopicModelTopicTitle = @"topicTitle";
NSString *const kMyAttendTopicModelTopicViewPointCount = @"topicViewPointCount";
NSString *const kMyAttendTopicModelViewpointLikeCount = @"viewpointLikeCount";

@interface MyAttendTopicModel ()
@end
@implementation MyAttendTopicModel




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kMyAttendTopicModelCollectCount] isKindOfClass:[NSNull class]]){
		self.collectCount = [dictionary[kMyAttendTopicModelCollectCount] integerValue];
	}

	if(![dictionary[kMyAttendTopicModelContent] isKindOfClass:[NSNull class]]){
		self.content = dictionary[kMyAttendTopicModelContent];
	}	
	if(![dictionary[kMyAttendTopicModelCreateTime] isKindOfClass:[NSNull class]]){
		self.createTime = dictionary[kMyAttendTopicModelCreateTime];
	}	
	if(![dictionary[kMyAttendTopicModelHeadImg] isKindOfClass:[NSNull class]]){
		self.headImg = dictionary[kMyAttendTopicModelHeadImg];
	}	
	if(dictionary[kMyAttendTopicModelImgList] != nil && [dictionary[kMyAttendTopicModelImgList] isKindOfClass:[NSArray class]]){
		NSArray * imgListDictionaries = dictionary[kMyAttendTopicModelImgList];
		NSMutableArray * imgListItems = [NSMutableArray array];
		for(NSDictionary * imgListDictionary in imgListDictionaries){
			SpecialworkImgList * imgListItem = [[SpecialworkImgList alloc] initWithDictionary:imgListDictionary];
			[imgListItems addObject:imgListItem];
		}
		self.imgList = imgListItems;
	}
	if(![dictionary[kMyAttendTopicModelInteractionId] isKindOfClass:[NSNull class]]){
		self.interactionId = [dictionary[kMyAttendTopicModelInteractionId] integerValue];
	}

	if(![dictionary[kMyAttendTopicModelIsCollected] isKindOfClass:[NSNull class]]){
		self.isCollected = [dictionary[kMyAttendTopicModelIsCollected] integerValue];
	}

	if(![dictionary[kMyAttendTopicModelIsVeteran] isKindOfClass:[NSNull class]]){
		self.isVeteran = [dictionary[kMyAttendTopicModelIsVeteran] boolValue];
	}

	if(![dictionary[kMyAttendTopicModelNickName] isKindOfClass:[NSNull class]]){
		self.nickName = dictionary[kMyAttendTopicModelNickName];
	}	
	if(![dictionary[kMyAttendTopicModelTopicId] isKindOfClass:[NSNull class]]){
		self.topicId = [dictionary[kMyAttendTopicModelTopicId] integerValue];
	}

	if(![dictionary[kMyAttendTopicModelTopicPic] isKindOfClass:[NSNull class]]){
		self.topicPic = dictionary[kMyAttendTopicModelTopicPic];
	}	
	if(![dictionary[kMyAttendTopicModelTopicTitle] isKindOfClass:[NSNull class]]){
		self.topicTitle = dictionary[kMyAttendTopicModelTopicTitle];
	}	
	if(![dictionary[kMyAttendTopicModelTopicViewPointCount] isKindOfClass:[NSNull class]]){
		self.topicViewPointCount = [dictionary[kMyAttendTopicModelTopicViewPointCount] integerValue];
	}

	if(![dictionary[kMyAttendTopicModelViewpointLikeCount] isKindOfClass:[NSNull class]]){
		self.viewpointLikeCount = [dictionary[kMyAttendTopicModelViewpointLikeCount] integerValue];
	}

	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	dictionary[kMyAttendTopicModelCollectCount] = @(self.collectCount);
	if(self.content != nil){
		dictionary[kMyAttendTopicModelContent] = self.content;
	}
	if(self.createTime != nil){
		dictionary[kMyAttendTopicModelCreateTime] = self.createTime;
	}
	if(self.headImg != nil){
		dictionary[kMyAttendTopicModelHeadImg] = self.headImg;
	}
	if(self.imgList != nil){
		NSMutableArray * dictionaryElements = [NSMutableArray array];
		for(SpecialworkImgList * imgListElement in self.imgList){
			[dictionaryElements addObject:[imgListElement toDictionary]];
		}
		dictionary[kMyAttendTopicModelImgList] = dictionaryElements;
	}
	dictionary[kMyAttendTopicModelInteractionId] = @(self.interactionId);
	dictionary[kMyAttendTopicModelIsCollected] = @(self.isCollected);
	dictionary[kMyAttendTopicModelIsVeteran] = @(self.isVeteran);
	if(self.nickName != nil){
		dictionary[kMyAttendTopicModelNickName] = self.nickName;
	}
	dictionary[kMyAttendTopicModelTopicId] = @(self.topicId);
	if(self.topicPic != nil){
		dictionary[kMyAttendTopicModelTopicPic] = self.topicPic;
	}
	if(self.topicTitle != nil){
		dictionary[kMyAttendTopicModelTopicTitle] = self.topicTitle;
	}
	dictionary[kMyAttendTopicModelTopicViewPointCount] = @(self.topicViewPointCount);
	dictionary[kMyAttendTopicModelViewpointLikeCount] = @(self.viewpointLikeCount);
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	[aCoder encodeObject:@(self.collectCount) forKey:kMyAttendTopicModelCollectCount];	if(self.content != nil){
		[aCoder encodeObject:self.content forKey:kMyAttendTopicModelContent];
	}
	if(self.createTime != nil){
		[aCoder encodeObject:self.createTime forKey:kMyAttendTopicModelCreateTime];
	}
	if(self.headImg != nil){
		[aCoder encodeObject:self.headImg forKey:kMyAttendTopicModelHeadImg];
	}
	if(self.imgList != nil){
		[aCoder encodeObject:self.imgList forKey:kMyAttendTopicModelImgList];
	}
	[aCoder encodeObject:@(self.interactionId) forKey:kMyAttendTopicModelInteractionId];	[aCoder encodeObject:@(self.isCollected) forKey:kMyAttendTopicModelIsCollected];	[aCoder encodeObject:@(self.isVeteran) forKey:kMyAttendTopicModelIsVeteran];	if(self.nickName != nil){
		[aCoder encodeObject:self.nickName forKey:kMyAttendTopicModelNickName];
	}
	[aCoder encodeObject:@(self.topicId) forKey:kMyAttendTopicModelTopicId];	if(self.topicPic != nil){
		[aCoder encodeObject:self.topicPic forKey:kMyAttendTopicModelTopicPic];
	}
	if(self.topicTitle != nil){
		[aCoder encodeObject:self.topicTitle forKey:kMyAttendTopicModelTopicTitle];
	}
	[aCoder encodeObject:@(self.topicViewPointCount) forKey:kMyAttendTopicModelTopicViewPointCount];	[aCoder encodeObject:@(self.viewpointLikeCount) forKey:kMyAttendTopicModelViewpointLikeCount];
}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.collectCount = [[aDecoder decodeObjectForKey:kMyAttendTopicModelCollectCount] integerValue];
	self.content = [aDecoder decodeObjectForKey:kMyAttendTopicModelContent];
	self.createTime = [aDecoder decodeObjectForKey:kMyAttendTopicModelCreateTime];
	self.headImg = [aDecoder decodeObjectForKey:kMyAttendTopicModelHeadImg];
	self.imgList = [aDecoder decodeObjectForKey:kMyAttendTopicModelImgList];
	self.interactionId = [[aDecoder decodeObjectForKey:kMyAttendTopicModelInteractionId] integerValue];
	self.isCollected = [[aDecoder decodeObjectForKey:kMyAttendTopicModelIsCollected] integerValue];
	self.isVeteran = [[aDecoder decodeObjectForKey:kMyAttendTopicModelIsVeteran] boolValue];
	self.nickName = [aDecoder decodeObjectForKey:kMyAttendTopicModelNickName];
	self.topicId = [[aDecoder decodeObjectForKey:kMyAttendTopicModelTopicId] integerValue];
	self.topicPic = [aDecoder decodeObjectForKey:kMyAttendTopicModelTopicPic];
	self.topicTitle = [aDecoder decodeObjectForKey:kMyAttendTopicModelTopicTitle];
	self.topicViewPointCount = [[aDecoder decodeObjectForKey:kMyAttendTopicModelTopicViewPointCount] integerValue];
	self.viewpointLikeCount = [[aDecoder decodeObjectForKey:kMyAttendTopicModelViewpointLikeCount] integerValue];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	MyAttendTopicModel *copy = [MyAttendTopicModel new];

	copy.collectCount = self.collectCount;
	copy.content = [self.content copyWithZone:zone];
	copy.createTime = [self.createTime copyWithZone:zone];
	copy.headImg = [self.headImg copyWithZone:zone];
	copy.imgList = [self.imgList copyWithZone:zone];
	copy.interactionId = self.interactionId;
	copy.isCollected = self.isCollected;
	copy.isVeteran = self.isVeteran;
	copy.nickName = [self.nickName copyWithZone:zone];
	copy.topicId = self.topicId;
	copy.topicPic = [self.topicPic copyWithZone:zone];
	copy.topicTitle = [self.topicTitle copyWithZone:zone];
	copy.topicViewPointCount = self.topicViewPointCount;
	copy.viewpointLikeCount = self.viewpointLikeCount;

	return copy;
}
@end
